//
//  CollectionView.m
//  Meng
//
//  Created by dllo on 15/9/29.
//  Copyright (c) 2015年 ljw. All rights reserved.
//

#import "CollectionView.h"

@implementation CollectionView
- (void)dealloc
{
    [_collection release];
    [_folw release];
    [super dealloc];
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.folw = [[UICollectionViewFlowLayout alloc] init];
        self.collection = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height) collectionViewLayout:self.folw];
        [self addSubview:self.collection];
        [_collection release];
        [_folw release];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.folw.minimumInteritemSpacing = 0;
    self.folw.minimumLineSpacing = 0;
    self.folw.itemSize = CGSizeMake(self.frame.size.width, self.frame.size.height);
    self.folw.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
    self.folw.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    self.collection.pagingEnabled = YES;
    self.collection.showsHorizontalScrollIndicator = NO;
    self.collection.backgroundColor = [UIColor whiteColor];

}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
